﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PanelControler : MonoBehaviour {

	public GameObject startPanel;
	public GameObject recogPanel;

	public GameObject webCameraPlane = null;
	 
	public static PanelControler instance = null;

	public GameObject recog_talkButton = null;
	public GameObject recog_confirmButton = null;

	void Awake()
	{
		instance = this;

		webCameraPlane.SetActive (false);

		startPanel.SetActive (true);
		recogPanel.SetActive (false);
		webCameraPlane.SetActive (false);
	}

	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		
	}

	public void albumClicked(GameObject go)
	{
		AlbumCamera.CallAlbum ();
	}

	public void start_TalkClicked(GameObject go)
	{
		webCameraPlane.SetActive (true);

		startPanel.SetActive (false);

		recogPanel.SetActive (true);

		recog_confirmButton.SetActive (false);
		recog_talkButton.SetActive (true);

	}

	public void recog_ConfirmClicked()
	{
		recog_confirmButton.SetActive (false);
		Invoke ("_setTalkButtonActive",0.5f);
		WebCameraManager.instance.FreezePlane.SetActive (false);
		WebCameraManager.instance.Plane.SetActive (true);
	}

	void _setTalkButtonActive()
	{
		recog_talkButton.SetActive (true);
	}

	public void shareClicked(GameObject go)
	{
		
	}

	public void albumImageReturned(string path, int width, int height)
	{
		startPanel.SetActive(false);
		recogPanel.SetActive(true);

		TFTest.instance.talkImpl (path);
	}

	public void recog_returnClicked()
	{
		startPanel.SetActive (true);
		recogPanel.SetActive (false);
		WebCameraManager.instance.FreezePlane.SetActive (false);
		WebCameraManager.instance.Plane.SetActive (false);
	}
}
